package com.zzyl.service.impl;

import com.zzyl.dto.LoginDto;
import com.zzyl.enums.BasicEnum;
import com.zzyl.exception.BaseException;
import com.zzyl.mapper.LoginMapper;
import com.zzyl.service.LoginService;
import com.zzyl.utils.ObjectUtil;
import com.zzyl.vo.UserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LoginServiceImpl implements LoginService {

    @Autowired
    private LoginMapper loginMapper;

    @Override
    public UserVo login(LoginDto loginDto) {
        UserVo userVo= loginMapper.login(loginDto);
        if (ObjectUtil.isEmpty(userVo)){
            throw new BaseException(BasicEnum.LOGIN_FAIL);
        }
        return userVo;
    }
}
